var utils = require('../../utils/util.js');
Component({
  properties: {
    isShow:{
      type:Boolean,
      value:true
    }
  },
  data: {
    autoShow:false,
  },
  ready(){
    var pages = getCurrentPages();
    if (pages.length == 1){
      this.setData({
        autoShow:true
      })
    }
    wx.getSystemInfo({
      success: (res) => {
        this.setData({
          maskbox: Math.floor((100 * res.windowWidth) / 750),
          windowWidth: res.windowWidth,
          windowHeight: res.windowHeight,
        })
      }
    })
  },
  methods: {
    goHome(){
      wx.switchTab({
        url: '/pages/index/index',
      })
    },
    viewTouchMove: function (e) {//返回顶部按钮拖动的更新位置
      var { maskbox, windowWidth, windowHeight } = this.data;
      var x = e.touches[0].clientX;
      var y = e.touches[0].clientY;
      if ((x <= windowWidth - maskbox && y <= windowHeight - maskbox) && x >= 1 && y >= 1) {
        this.setData({
          left: ((e.touches[0].clientX) < 0 ? 10 : e.touches[0].clientX) + 'px',
          top: ((e.touches[0].clientY) < 0 ? 20 : e.touches[0].clientY) + 'px'
        })
      }
    },
  }
})
